Skip to content

test: fix vacuous is_err() assertions in create_git_tag and comment_on_work_item#1578

Merged
jamesadevine merged 1 commit into
mainfrom
test/fix-bare-is-err-create-git-tag-comment-work-item-3ad9617237d777ce
Jul 21, 2026
Merged

test: fix vacuous is_err() assertions in create_git_tag and comment_on_work_item#1578
jamesadevine merged 1 commit into
mainfrom
test/fix-bare-is-err-create-git-tag-comment-work-item-3ad9617237d777ce

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/safe_outputs/create_git_tag.rs + src/safe_outputs/comment_on_work_item.rs

What was wrong

  • test_validation_rejects_short_message (create_git_tag): bare assert!(result.is_err()) — passes even if the wrong validator fires (e.g. tag_name check running instead of message check).
  • test_validation_rejects_repository_pipeline_command (create_git_tag): bare assert!(result.is_err()) — passes even if any unrelated validation rejects the input.
  • test_validation_rejects_zero_work_item_id (comment_on_work_item): bare assert!(result.is_err()) — would pass even if a completely different field caused the error.
  • test_validation_rejects_negative_work_item_id (comment_on_work_item): same issue — assertion says nothing about which field was rejected or why.
  • test_validation_rejects_short_body (comment_on_work_item): same issue — body-length guard could regress without the test catching it.

Changes

Test File Action Reason
test_validation_rejects_short_message create_git_tag.rs Rewritten Bare is_err()unwrap_err() + assert contains "message must be at least 5 characters"
test_validation_rejects_repository_pipeline_command create_git_tag.rs Rewritten Bare is_err()unwrap_err() + assert contains "pipeline command"
test_validation_rejects_zero_work_item_id comment_on_work_item.rs Rewritten Bare is_err()unwrap_err() + assert contains "work_item_id must be positive"
test_validation_rejects_negative_work_item_id comment_on_work_item.rs Rewritten Bare is_err()unwrap_err() + assert contains "work_item_id must be positive"
test_validation_rejects_short_body comment_on_work_item.rs Rewritten Bare is_err()unwrap_err() + assert contains "body must be at least 10 characters"

Verification

  • cargo test: 2569+ tests pass, 0 failed ✅
  • cargo clippy: no new warnings ✅

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • spsprodeus21.vssps.visualstudio.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "spsprodeus21.vssps.visualstudio.com"

See Network Configuration for more information.

Generated by Test Reducer · 60.1 AIC · ⌖ 12.1 AIC · ⊞ 8.7K ·

…n_work_item

Replace bare assert!(result.is_err()) with unwrap_err() + message content
assertions so regressions that produce the wrong error cannot silently pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine
jamesadevine marked this pull request as ready for review July 21, 2026 13:44
@jamesadevine
jamesadevine merged commit a811f5e into main Jul 21, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant